<template>
  <div class="come-card">
    <ul
      @transitionend="changeShow"
      :style="{ marginLeft: -active * 100 + 'vw' }"
    >
      <li>
        <img src="@/assets/image/ComeCard/bg1.png" alt="" />
        <div class="content">
          <div></div>
          <p>Now you can get groceries item at your doorstep.</p>
        </div>
        <div class="next" @click="pathTo(1)">
          <van-icon size="30" name="arrow" />
        </div>
      </li>
      <li>
        <img src="@/assets/image/ComeCard/bg2.png" alt="" />
        <div class="content">
          <div>Delevering groceries under 15 minutes</div>
          <p>Explore and order your favourite grocery items.</p>
        </div>
        <div class="next2" @click="pathTo(2)">Explore</div>
      </li>
    </ul>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useTabbarStore } from "@/store";
const active = ref(0);
const store = useTabbarStore();
const pathTo = (number) => {
  active.value = number;
};
const changeShow = () => {
  if (active.value === 2) {
    store.hide = false;
    active.value = 0;
  }
};
</script>

<style lang="scss">
.come-card {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: transparent;
  position: fixed;
  top: 0;
  z-index: 3;

  ul {
    color: var(--font-color);
    background-color: var(--background-color);
    width: 200%;
    height: 100%;
    display: flex;
    transition: 0.5s;

    &.avtive {
      margin-left: -100vw;
    }

    li {
      height: 100%;
      width: 50%;
      box-sizing: border-box;
      @include flex(column, center, center);

      img {
        height: 350rem;
      }

      .content {
        height: 134rem;
        margin-bottom: 20rem;

        div {
          margin-top: 20rem;
          height: 70rem;
          font-size: 24rem;
          font-weight: 600;
          text-align: center;
        }

        p {
          margin: 0 auto;
          width: 300rem;
          font-size: 16rem;
          text-align: center;
        }
      }

      .next,
      .next2 {
        font-size: 16rem;
        background-color: $color-yellow;
        height: 60rem;
        width: 60rem;
        border-radius: 50%;
        @include flex($jc: center, $ai: center);
      }

      .next2 {
        border-radius: 8rem;
        height: 44rem;
        width: 216rem;
        font-weight: 600;
      }
    }
  }
}
</style>
